<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

//home
Route::group(['domain' => config('app.website.HOME_DOMAIN')], function () {
    Route::get('/', function () {
        return view('home.index');
    });

});


Route::group(['domain' => config('app.website.GATEWAY_DOMAIN'), 'namespace' => 'Gateway'], function ($router) {

    $router->group(['prefix' => 'recharge'], function ($router) {
        $router->any('pay', 'RechargeGatewayController@pay')->name('gateway.recharge.pay');
        $router->any('callback/{identify}', 'RechargeGatewayController@callback')->name('gateway.recharge.callback');
        $router->any('return/{identify}', 'RechargeGatewayController@returnHref')->name('gateway.recharge.return');

    });

});

//buz
Route::group([
    'domain' => config('app.website.BUZ_DOMAIN'),
    'namespace' => 'Buz',
    'middleware' => ['web']
], function ($router) {
    Route::get('login', function () {
        return view('buz.auth.login');
    })->name('buz.auth.login');
    Route::get('register_one', function () {
        return view('buz.auth.register.register_one');
    })->name('buz.register_one');
    Route::get('register_two', 'AuthController@doRegister')->name('buz.doregister');
    Route::get('register_email', 'AuthController@registerEmail')->name('buz.register_email');

    Route::get('register_three', function () {
        return view('buz.auth.register.register_three');
    })->name('buz.register_three');
    Route::get('forgetpwd', function () {
        return view('buz.auth.forget.forgetpwd');
    });
    Route::get('pwdUpdate', function () {
        return view('buz.auth.forget.pwdUpdate');
    });

    $router->group(['middleware' => ['web-auth']], function ($router) {
        //完善信息
        $router->get('auth/protocol', function () {
            return view('buz.information.prefectInfoPro');
        })->name('buz.auth.protocol');
        $router->get('auth/base', function () {
            return view('buz.information.prefectInfoBasic');
        })->name('buz.auth.base');
        $router->get('auth/remit', function () {
            return view('buz.information.prefectInfoSettlemet');
        })->name('buz.auth.remit');

        $router->group(['middleware' => 'web-info-complete'], function ($router) {
            $router->get('index', function () {
                return view('buz.index');
            });

            //应用充值记录
            $router->get('app/{id}/orders', function ($id) {
                return view('buz.app.payment', compact('id'));
            });
            //应用信息
            $router->get('app/{id}', function ($id) {
                return view('buz.app.info', ['id' => $id]);
            });
            //技术对接
            $router->get('app/docking', function () {
                return view('buz.app.docking');
            });


            //基本信息
            $router->get('member/info', function () {
                return view('buz.member.mindex');
            });
            //结算信息
            $router->get('member/remit', function () {
                return view('buz.member.msettlement');
            });
            //
//    $router->get('member/channel', function () {
//        return view('buz.member.mchannel');
//    });
            //密码管理
            $router->get('member/pwd', function () {
                return view('buz.member.mpassword');
            });
            //隐私数据
            $router->get('member/privacy', function () {
                return view('buz.member.mprivacy');
            });
            //技术协议
            $router->get('member/agreement', function () {
                return view('buz.member.magreement');
            });

            //代付
            $router->get('remit/topay', function () {
                return view('buz.remit.topay');
            });
            //代付记录
            $router->get('remit/topayList', function () {
                return view('buz.remit.topayList');
            });
            //提现
            $router->get('remit/withdraw', function () {
                return view('buz.remit.withdraw');
            });
            //提现记录
            $router->get('remit/withdrawList', function () {
                return view('buz.remit.withdrawList');
            });
        });


    });

});



Route::group(['namespace' => 'Gateway\Page'], function ($r) {
    $r->get('recharge/pay',function () {
        return view('gateway.recharge.pay');
    });
    $r->post('recharge/pay', 'RechargeController@pay');
    $r->any('recharge/callback', 'RechargeController@callback')->name('page.callback');
});
